package com.gangwangchina.android.contactlib.model;

import java.util.HashMap;
import java.util.Map;

import com.gangwangchina.android.contactlib.ContactsInterface;

import android.provider.ContactsContract.CommonDataKinds.Note;


public class Notes extends DataElement{
	public static final String NOTE = Note.NOTE;
	public static final String CONTENT_ITEM_TYPE = Note.CONTENT_ITEM_TYPE;


	public String notes;

	/**
	 * Creates a new Notes that is not (yet) present in the database
	 * @param notes
	 * @return
	 */
	public static Notes newNotes(String notes){
		return new Notes(notes);
	}

	/**
	 * Creates an object representation of a Notes that is present in the database
	 * @param pcId
	 * @param notes
	 * @return
	 */
	public static Notes recoverNotes(long pcId, String notes){
		return new Notes(pcId, notes);
	}

	/**
	 * Creates a new Notes
	 * @param pcId the PersonContact the Notes is linked to
	 * @param notes
	 */
	private Notes(long pcId, String notes){
		this(pcId);
		this.notes = notes;
	}

	private Notes(String notes){
		this(ContactsInterface.NO_ID, notes);
	}

	private Notes(long pcId){
		super(pcId, CONTENT_ITEM_TYPE);
	}



//	@Override
	public String toString(){		
//		return "{'note':" + this.safeJson(notes) + "}";		
		return "";
	}

	@Override
	public Map<String, Object> getDataColumns() {
		Map<String, Object> datas = new HashMap<String, Object>();
		datas.put(NOTE, notes);
		return datas;
	}

	@Override
	public boolean setProperty(String key, Object value){
		if(key.equals(NOTE)) notes = (String) value;
		else return super.setProperty(key, value);
		return true;
	}

	@Override
	public Object getProperty(String key){
		if(key.equals(NOTE)) return notes;
		return super.getProperty(key);
	}
}